Welcome to Packaging. After watching this video, you will be able to Differentiate between Python module, package, and library Create a Python package Verify a Python package And use a Python package Modules, packages, and libraries are frequently used terms in Python. Let's look at each of the terms in detail. A Python module is a .py file containing Python definitions, statements, functions, and classes. You can import a module to other scripts and notebooks. For example, consider a module named module.py that has two functions. The first function is def square number return number asterisk asterisk two, which squares the input and returns the result as an output. The second function is def doubler number return number asterisk two, which doubles the input and returns the result as an output. If the function is in the same directory, you can import it and use the functions in that module. Let's consider using the square function with print command. Four caret symbol two square four, the output is displayed as four caret symbol two equals sixteen. Similarly, for the print doubler function with value four, the output is two asterisk four equals eight. A package is a collection of Python modules into a directory with an init.py file, which distinguishes it from just a directory of Python scripts. The example shows the package my project in parent directory with two modules, module one.py and module two.py. It also contains init.py file. When you import a module or a package, the corresponding object created by Python is always of type module. Note that the distinction between module and package is only at the file system level. A library is a collection of packages or it can be a single package. Examples include NumPy, PyTorch and Pandas. Note that the terms package and library are often used interchangeably. Therefore, NumPy, PyTorch and Pandas are also referred to as packages. Let's look at the steps to create a Python package. Consider there are two modules. Module one.py has two functions, square and doubler. Module two.py has one function, mean. To make my project folder into a package, you must have init.py as a file in the my project folder. The contents of the init.py file must be from .importmodule1 and from .importmodule2. Typical steps to create a package include. First, create a folder with the package name. Then, create an empty init.py file. Create the required modules. Finally, in the init.py file, add code to reference the modules needed in the package. After creating the package, you need to verify the package. To verify the package, first, open a bash terminal. Make sure the directory is the same as the folder where your package is located. Open the Python interpreter by running the command python in the shell. Using the Python prompt, type import followed by project name. For example, import my project. If the command runs without errors, it is an indication that the package is successfully loaded. The general structure for testing your package is the package name, .module name, .function name, followed by the parameters without the curly brackets but keeping the round brackets. For example, using my project, myproject.basic.square to the function will return the value 4. After creating the package, you can use it in the other scripts if the package folder is in the same directory. In this case, you have the file test.py in the parent directory. You can import the functions in the package. For example, using the Python code from myproject.module1.importsquare,doubler, from myproject.module2.importmean.print4.carat.symbol2.equals.square. For print2.*.4.equals.doubler. For print2.plus1.plus3.dividedby3.equals.mean.2,1,3. You can then run the functions and check if you get the correct results. In this video, you learned that A Python module is a .py file containing Python definitions, statements, functions, and classes. A package is a collection of Python modules into a directory with an init.py file. A library is a collection of packages, or it can be a single package. To create a package, create a folder with the package name, create an empty init.py file, create the required modules. In the init.py file, add code to reference the modules needed in the package. You can verify the package via the bash terminal. After creating the package, you can use it on other scripts if the package folder is in the same directory.